package ${implPackage}

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
import com.baomidou.mybatisplus.extension.kotlin.KtUpdateWrapper
import org.springframework.stereotype.Service
import ${entityPackage}.${entityName}
import ${mapperPackage}.${mapperName}
import ${servicePackage}.${serviceName}

/**
* ${tableComment}(table: ${tableName})接口实现
* @author ${author}
* @since ${date}
*/
@Service
open class ${implName} : ServiceImpl<${mapperName},${entityName}>(),${serviceName}{

    /**
     * 根据主键更新不为空的字段
     * @author ${author}
     * @since ${date}
     * @param entity:
     */
    override fun updateSelectiveById(entity: ${entityName}){
        val wrapper = KtUpdateWrapper(${entityName}::class.java)
<#if primaryColumn?? && (primaryColumn?size >0)>
 <#list primaryColumn as column>
        wrapper.eq(${entityName}::${column.javaFiled},entity.${column.javaFiled})
  </#list>
</#if>
<#if normalColumn?? && (normalColumn?size >0)>
 <#list normalColumn as column>
        if(entity.${column.javaFiled} != null) wrapper.set(${entityName}::${column.javaFiled},entity.${column.javaFiled})
 </#list>
        update(wrapper)
</#if>
    }

}

